function getPassOption(scores) {
    // console.log('scores', scores);

    const commonOption = [
        '{title|{b}}{abg|}',
        '{header|姓名}{header|理论}{header|技能}',
        '{hr|}',
    ];

    const passOptionArr = [...commonOption];
    const passScores = scores.filter((item) => {
        if (item.theory >= 90 && item.skill >= 90) {
            passOptionArr.push(
                `{value|${item.relname}}{value|${item.theory}}{value|${item.skill}}`,
            );
            return item;
        }
    });

    const nopassOptionArr = [...commonOption];
    const nopassScores = scores.filter((item) => {
        if (item.theory < 90 || item.skill < 90) {
            nopassOptionArr.push(
                `{value|${item.relname}}{value|${item.theory}}{value|${item.skill}}`,
            );
            return item;
        }
    });

    // console.log({ passScores, nopassScores });

    return {
        title: {
            text: '1710A班今日成材率',
            left: 'center',
        },
        legend: {
            orient: 'vertical',
            bottom: 10,
            left: 'center',
            data: ['及格', '不及格'],
        },
        series: [
            {
                type: 'pie',
                radius: '55%',
                center: ['50%', '50%'],
                selectedMode: 'single',
                data: [
                    {
                        value: passScores.length,
                        name: '成材人员列表',
                        label: {
                            formatter: passOptionArr.join('\n'),
                            backgroundColor: '#eee',
                            borderColor: '#777',
                            borderWidth: 1,
                            borderRadius: 3,
                            rich: {
                                title: {
                                    color: '#c6c6c6',
                                    align: 'center',
                                },
                                abg: {
                                    backgroundColor: '#333',
                                    width: '100%',
                                    align: 'right',
                                    height: 25,
                                    borderRadius: [4, 4, 0, 0],
                                },
                                header: {
                                    color: '#333',
                                    height: 30,
                                    align: 'left',
                                    padding: [0, 12],
                                },
                                value: {
                                    color: '#333',
                                    padding: [5, 15],
                                    align: 'left',
                                },
                                hr: {
                                    borderColor: '#777',
                                    width: '100%',
                                    borderWidth: 0.5,
                                    height: 0,
                                },
                            },
                        },
                    },
                    {
                        value: nopassScores.length,
                        name: '不成材人员列表',
                        label: {
                            formatter: nopassOptionArr.join('\n'),
                            backgroundColor: '#eee',
                            borderColor: '#777',
                            borderWidth: 1,
                            borderRadius: 3,
                            rich: {
                                title: {
                                    color: '#c6c6c6',
                                    align: 'center',
                                },
                                abg: {
                                    backgroundColor: '#333',
                                    width: '100%',
                                    align: 'right',
                                    height: 25,
                                    borderRadius: [4, 4, 0, 0],
                                },
                                header: {
                                    color: '#333',
                                    height: 30,
                                    align: 'left',
                                    padding: [0, 12],
                                },
                                value: {
                                    color: '#333',
                                    padding: [5, 15],
                                    align: 'left',
                                },
                                hr: {
                                    borderColor: '#777',
                                    width: '100%',
                                    borderWidth: 0.5,
                                    height: 0,
                                },
                            },
                        },
                    },
                ],
            },
        ],
    };
}

export default getPassOption;
